{template '_header'}

    <div class="page-header">
        当前位置：<span class="text-primary">编辑商品</span>
    </div>

<div class="page-content" style="display: block;">
    <div class="alert alert-warning">
        <h3>注意：</h3>
        <p>如果开启状态未被勾选,则此商品规格在该门店将被设置为无库存状态,并且门店管理员将无权修改此规格.</p>
    </div>

    <form action="" method="post" class="form-horizontal form-validate" enctype="multipart/form-data" novalidate="novalidate">
    <table class="table table-bordered table-condensed">
        <thead>
        <tr class="active">
            <th><input type="checkbox" name="ids"> 开启</th>
            {loop $spec $k $v}
            <th>{$v['title']}</th>
            {/loop}
            <th>
                <div class="">
                    <div style="padding-bottom:10px;text-align:center;">库存</div>
                    <input type="number" class="form-control" value="" onchange="if($(this).val()>0){$('.total').val($(this).val())}">
                </div>
            </th>
            <th>
                <div class="">
                    <div style="padding-bottom:10px;text-align:center;">价格</div>
                    <input type="number" class="form-control" value="" name="" onchange="if($(this).val()>0){$('.price').val($(this).val())}">
                </div>
            </th>
        </tr>
        </thead>
        <tbody>
        {loop $option $k $v}
        <tr>
            <td><input type="checkbox" name="ids[]" value="{$v['id']}" {if empty($v['deleted'])} checked {/if}>
            </td>
            {php $optiontitle = explode('+',$v['title']);}
                {loop $optiontitle $ok $ov}
                    <td class="full" rowspan="1">{$ov}</td>
                {/loop}
            <td>
                <input type="number" class="form-control total" value="{$v['stock']}" name="total[{$v['id']}]">
            </td>
            <td>
                <input type="number" class="form-control price" value="{$v['marketprice']}" name="price[{$v['id']}]">
            </td>
        </tr>
        {/loop}
        </tbody>
    </table>
    <button class="btn btn-primary">保存</button>
    <a class="btn btn-default" onclick="history.back(-1)">返回列表</a>
    </form>
</div>
{template '_footer'}